package com.yn.xgame.game;

import com.alibaba.fastjson.annotation.JSONField;
import com.yn.xgame.pb.CommonProto;

/**
 * RoomPlayer
 * 房间玩家
 * Created by wangboo on 17/7/15.
 */
public class RoomPlayer {

    @JSONField(serialize = false)
    public int roomId;     // 房间id
    @JSONField(serialize = false)
    public int tableId;    // 桌子id
    @JSONField(serialize = false)
    public int tablePos;   // 桌子中的位置
    @JSONField(serialize = false)
    public boolean isOnline; // 是否在线
    @JSONField(serialize = false)
    public boolean prepared; // 是否准备
    @JSONField(serialize = false)
    public String gameTopic;

    public long sid;
    @JSONField(name = "logic")
    public String logicTopic;
    @JSONField(name = "gate")
    public String gateTopic;
    public int userId;
    public String nickName;
    @JSONField(name = "uwg")
    public long userWalletGold;
    public int userHorn;
    public int userIcon;
    public int userVipLevel;
    public int userLevel;
    public int userExp;

    public RoomPlayer() {
    }

    public RoomPlayer(long sid, int userId) {
        this.sid = sid;
        this.userId = userId;
    }

    @JSONField(serialize = false)
    public CommonProto.RoomPlayerSimpleInfo getPlayerSimpleInfo() {
        return CommonProto.RoomPlayerSimpleInfo.newBuilder()
                .setGold(Long.toString(userWalletGold))
                .setIcon(userIcon)
                .setUserId(userId)
                .setIsOnline(isOnline)
                .setLv(userLevel)
                .setVip(userVipLevel)
                .setNickName(nickName)
                .setTablePos(tablePos)
                .setPrepared(prepared)
                .build();
    }
}
